package hczc.longcai.com.hccrowdfunding.home.second_invest.fragments;


import android.content.Intent;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;

import hczc.longcai.com.hccrowdfunding.R;
import hczc.longcai.com.hccrowdfunding.application.BaseApplication;
import hczc.longcai.com.hccrowdfunding.home.second_invest.activities.AffirmReturnActivity;

/**
 * A simple {@link Fragment} subclass.
 */
public class ReturnFootFragment extends Fragment implements View.OnClickListener, View.OnTouchListener {


    private ImageView like;
    private ImageView share;

    public ReturnFootFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_return_foot, container, false);
        BaseApplication.scaleScreenHelper.loadView(((ViewGroup) view));
        initViews(view);

        return view;
    }

    private void initViews(View view) {
        view.findViewById(R.id.return_foot_support).setOnClickListener(this);
        like = ((ImageView) view.findViewById(R.id.return_foot_like));
        like.setOnClickListener(this);
        like.setOnTouchListener(this);
        share = ((ImageView) view.findViewById(R.id.return_foot_share));
        share.setOnClickListener(this);
        share.setOnTouchListener(this);
    }


    @Override
    public void onClick(View view) {
        int id = view.getId();
        switch (id){
            case R.id.return_foot_support:
                startActivity(new Intent(getActivity(), AffirmReturnActivity.class));
                break;
            case R.id.return_foot_like:
                Toast.makeText(getActivity(),"点击了喜欢按钮",Toast.LENGTH_SHORT).show();
                break;
            case R.id.return_foot_share:
                Toast.makeText(getActivity(),"点击了分享按钮",Toast.LENGTH_SHORT).show();
                break;
        }
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        view.setPressed(true);
        return false;
    }
}
